<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('服务对象报餐记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>上报时间：</label>
                                <input type="text" class="time-input" placeholder="请选择上报时间" name="reportDate" th:value="${reportDate}"/>
                            </li>
                            <li>
                                <label>院区：</label>
                                <input type="text" name="campus" th:value="${campus}"/>
<!--                                <select name="campus" th:with="type=${@dict.getType('meal_campus')}">-->
<!--                                    <option value="">所有</option>-->
<!--                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="${reportDate}"></option>-->
<!--                                </select>-->
                            </li>
                            <li>
                                <label>班级：</label>
                                <input type="text" name="className" th:value="${className}"/>
                            </li>
                            <li>
                                <label>填报人：</label>
                                <input type="text" name="reportingPerson"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                    <i class="fa fa-download"></i> 导出汇总表
                </a>
                <a class="btn btn-warning" onclick="$.table.exportDetailExcel()" >
                    <i class="fa fa-download"></i> 导出明细表
                </a>
            </div>
            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('meal:meal:edit')}]];
        var removeFlag = [[${@permission.hasPermi('meal:meal:remove')}]];
        var prefix = ctx + "meal/meal";

        $(function() {
            var options = {
                url: prefix + "/listCount",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/exportDayReport",
                exportDetail:prefix + "/exportDayDetailReport",
                modalName: "服务对象报餐记录",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                columns: [
                    [{
                        checkbox: true,
                        rowspan:2
                    },
                        {
                            field: 'id',
                            title: 'id',
                            visible: false,
                            valign: 'middle',
                            rowspan:2
                        },

                        {
                            field: 'campus',
                            title: '院区',
                            valign: 'middle',
                            rowspan:2
                        },
                        {
                            field: 'className',
                            title: '班级',
                            valign: 'middle',
                            rowspan:2
                        },
                        {
                            field: 'reportDate',
                            title: '上报时间',
                            valign: 'middle',
                            rowspan:2
                        },
                        {
                            title : '早餐',
                            align : 'center',
                            colspan : 5
                        },
                            {
                                title : '午餐',
                                align : 'center',
                                colspan : 8
                            }, {
                                title : '晚餐',
                                align : 'center',
                                colspan : 5
                            },
                        {
                            field: 'reportingPerson',
                            title: '填报人',
                            valign: 'middle',
                            rowspan:2
                        },{
                        title : '',
                        align : 'center',
                        colspan : 1
                    }
                            ],
                    [
                {
                    field: 'mOrphan',
                    title: '孤儿'
                },
                {
                    field: 'mNothing',
                    title: '事无'
                },
                {
                    field: 'mGove',
                    title: '政府'
                },
                {
                    field: 'mPoor',
                    title: '特困'
                },
                {
                    field: 'mExpense',
                    title: '自费'
                },
                {
                    field: 'lOrphan',
                    title: '孤儿'
                },
                {
                    field: 'lNothing',
                    title: '事无'
                },
                {
                    field: 'lGove',
                    title: '政府'
                },
                {
                    field: 'lPoor',
                    title: '特困'
                },
                {
                    field: 'lExpense',
                    title: '自费'
                },
                {
                    field: 'miklTotal',
                    title: '牛奶'
                },
                        {
                            field: 'cookerTotal',
                            title: '点心'
                        },
                        {
                            field: 'fruitTotal',
                            title: '水果'
                        },
                {
                    field: 'dOrphan',
                    title: '孤儿'
                },
                {
                    field: 'dNothing',
                    title: '事无'
                },
                {
                    field: 'dGove',
                    title: '政府'
                },
                {
                    field: 'dPoor',
                    title: '特困'
                },
                {
                    field: 'dExpense',
                    title: '自费'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.reportDate  + '\',\'' + row.className  + '\',\'' + row.campus + '\')"><i class="fa fa-list-ul"></i>列表</a> ');
                        return actions.join('');
                    }
                }]]
            };
            $.table.init(options);
        });

        /*报餐明细-详细*/
        function detail(reportDate , className , campus) {
            var url = prefix + '/detail/' + reportDate+"/"+className+"/"+campus;
            $.modal.openTab("服务对象报餐明细", url);
        }
    </script>
</body>
</html>